/**
 * Copyright (c) 2002-2011 旭鸣信息
 * All rights reserved. 
 * File：ArticlesService.java
 * History:
 *       Apr 16, 2012: Initially created, liuzhi.
 */
package com.xteam.ecsystem.service.admin;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xteam.ecsystem.dao.IArticlesDao;

/**
 * 文章信息业务管理层
 * @author liuzhi
 *
 */
@Service
public class ArticlesService {
	
	@Autowired
	private IArticlesDao baiDao;
	
	/**
	 * 
	 * 新增或者修改文章信息
	 * @author liuzhi
	 * @param obj
	 * @param id
	 */
	public void saveOrUpdateObject(Object obj, String baiId){
		this.baiDao.saveOrUpdateObject(obj, baiId);
	}
	
	/**
	 * 
	 * 条件查询和分页显示文章信息
	 * @author liuzhi
	 * @param pageIndex
	 * @param pageSize
	 * @param baiTitle
	 * @param baiGroup
	 * @param baiTime
	 * @param baiState
	 * @return
	 */
	public String getBaiList(int pageIndex, int pageSize,
			String baiTitle, String baiGroup, String baiState){
		return this.baiDao.getBaiList(pageIndex, pageSize, baiTitle, baiGroup, baiState);
	}

	/**
	 * 
	 * 删除单条或多条文章信息
	 * @author liuzhi
	 * @param baiIds
	 */
	public void delObject(String baiIds){
		this.baiDao.delObject(baiIds);
	}
	
	/**
	 * 根据文章编号获得对应的文章信息
	 * @author liuzhi
	 * @param baiId
	 * @return
	 */
	public String getBaiById(String baiId){
		return this.baiDao.getBaiById(baiId);
	}
	
	/**
	 * 
	 * 根据文章编号修改文章状态
	 * 0：无效
	 * 1：有效
	 * @author liuzhi
	 * @param baiId
	 */
	public void updateBaiStateById(String baiId){
		this.baiDao.updateBaiStateById(baiId);
	}
	
	/**
	 * 根据id删除文章图标
	 * @author liuzhi
	 * @param baiId
	 */
	public void delBaiImageById(String baiId){
		this.baiDao.delBaiImageById(baiId);
	}
	
	/**
	 * 根据传递条件（add/query），加载文章分类treeselect
	 * @author liuzhi
	 * @param type
	 * @return
	 */
	public String getBagTreeSelect(String type){
		return this.baiDao.getBagTreeSelect(type);
	}
}
